<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>欢迎页</title>
    <link rel="stylesheet" href="../../static/frame/layui/css/layui.css">
    <link rel="stylesheet" href="../../static/frame/static/css/style.css">
    <link rel="icon" href="../../static/frame/static/image/code.png">
</head>
<body class="body">


<div class="layui-row layui-col-space10 my-index-main">

    <div class="layui-collapse">
        <div class="layui-colla-item">
            <h2 class="layui-colla-title">系统设置</h2>
            <div class="layui-colla-content layui-show">
                <form class="layui-form"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
                    <div class="layui-form-item">
                        <label class="layui-form-label">选项设置</label>
                        <div class="layui-input-block">
                            <input type="checkbox" name="indexpage" title="开启前台购买首页"> <input type="checkbox"
                                                                                             name="onlinepay"
                                                                                             title="开启在线支付"> <input
                                type="checkbox" name="emailtip" title="购买后邮件提醒">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">支付宝</label>
                        <div class="layui-input-block">
                            <input type="radio" name="alipaytype" value="0" title="免签约支付" checked>
                            <input type="radio" name="alipaytype" value="2" title="关闭支付">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">QQ钱包</label>
                        <div class="layui-input-block">
                            <input type="radio" name="qqpaytype" value="0" title="免签约支付" checked>
                            <input type="radio" name="qqpaytype" value="2" title="关闭支付">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">微信支付</label>
                        <div class="layui-input-block">
                            <input type="radio" name="wxpaytype" value="0" title="免签约支付" checked>
                            <input type="radio" name="wxpaytype" value="2" title="关闭支付">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="SystemSet">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                    <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
                </form>

            </div>
        </div>
    </div>

    <div class="layui-collapse">
        <div class="layui-colla-item">
            <h2 class="layui-colla-title">免签约设置</h2>
            <div class="layui-colla-content layui-show">
                <blockquote class="layui-elem-quote">
                    支持市面上大部分易支付，若不知道支付域名请联系供应商客服询问，部分易支付不支持回调二次验证，如果已付款跳回站点显示未付款请关闭二次验证
                </blockquote>
                <form class="layui-form"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
                    <div class="layui-form-item">
                        <label class="layui-form-label">支付域名</label>
                        <div class="layui-input-block">
                            <input type="text" name="pay_domain" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">支付PID</label>
                        <div class="layui-input-block">
                            <input type="text" name="epay_pid" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">支付秘钥</label>
                        <div class="layui-input-block">
                            <input type="password" name="epay_key" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">二次验证</label>
                        <div class="layui-input-block">
                            <input type="checkbox" name="epay_againcheck" lay-skin="switch" lay-text="开启|关闭">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="NoSignSet">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                    <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
                </form>

            </div>
        </div>
    </div>

</div>


<script src="../../static/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../static/frame/layui/layui.js"></script>
<script type="text/javascript" src="../../static/js/index.js"></script>
<script type="text/javascript" src="../../static/frame/echarts/echarts.min.js"></script>
<script type="text/javascript">
    var adlist = '';

    layui.use(['form', 'element', 'layer', 'vip_tab'], function () {
        // 打开选项卡
        $('.my-nav-btn').on('click', function () {
            if ($(this).attr('data-href')) {
                vipTab.add($(this), '<i class="layui-icon">' + $(this).find("button").html() + '</i>' + $(this).find('p:last-child').html(), $(this).attr('data-href'));
            }
        });

        var form = layui.form;
        var loading = layer.load();
        $.ajax({
            url: '../ajax.php?mod=getsysset',
            type: 'POST',
            dataType: 'json',
            data: '',
            success: function (data) {
                $("input[name='alipaytype'][value='" + data.alipaytype + "']").attr("checked", true);
                $("input[name='qqpaytype'][value='" + data.qqpaytype + "']").attr("checked", true);
                $("input[name='wxpaytype'][value='" + data.wxpaytype + "']").attr("checked", true);
                $("input:checkbox[name=indexpage]").attr("checked", data.xtsy);
                $("input:checkbox[name=onlinepay]").attr("checked", data.kqxt);
                $("input:checkbox[name=emailtip]").attr("checked", data.yjtx);
                $("input[name='pay_domain']").val(data.pay_domain);
                $("input[name='epay_pid']").val(data.epay_pid);
                $("input[name='epay_key']").val(data.epay_key);
                $("input:checkbox[name=epay_againcheck]").attr("checked", data.epay_againcheck);

                layer.close(loading);
                form.render();
            },
            error: function (data) {
                layer.close(loading);
                layer.msg('请求失败' + data);
            }
        })
        form.on('submit(NoSignSet)', function (data) {
            var loading = layer.load();
            $.ajax({
                url: '../ajax.php?mod=saveepayset',
                type: 'POST',
                dataType: 'html',
                data: 'pay_domain=' + data.field.pay_domain + '&epay_pid=' + data.field.epay_pid + '&epay_key=' + data.field.epay_key + '&epay_againcheck=' + data.field.epay_againcheck,
                success: function (data) {
                    layer.close(loading);
                    layer.msg(data);
                },
                error: function (data) {
                    layer.close(loading);
                    layer.msg('请求失败' + data);
                }
            })

            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        form.on('submit(SystemSet)', function (data) {
            var loading = layer.load();
            $.ajax({
                url: '../ajax.php?mod=savesysset',
                type: 'POST',
                dataType: 'html',
                data: 'alipaytype=' + data.field.alipaytype + '&qqpaytype=' + data.field.qqpaytype + '&wxpaytype=' + data.field.wxpaytype + '&kqxt=' + data.field.onlinepay + '&yjtx=' + data.field.emailtip + '&xtsy=' + data.field.indexpage,
                success: function (data) {
                    layer.close(loading);
                    layer.msg(data);
                },
                error: function (data) {
                    layer.close(loading);
                    layer.msg('请求失败' + data);
                }
            })

            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });


    });


</script>
</body>
</html>